package com.raos.lottery.redis.dal.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.raos.lottery.redis.dal.model.LotteryPrize;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

/**
 * 奖品接口
 *
 * @author raos
 * @emil 991207823@qq.com
 * @date 2021/7/21 23:01
 */
@Repository
public interface LotteryPrizeMapper extends BaseMapper<LotteryPrize> {

    /**
     * 更新有效奖项
     * @param id
     */
    @Update("update lottery_prize set valid_stock=valid_stock-1 where valid_stock>=1 and id=#{id}")
    void updateValidStock(@Param("id") Serializable id);
}
